<?php
if(!_check_permission_on_function($_SESSION['staff_id'], $_ISA_APP_CODE, _CONST_ONEGATE_AF_DELETE)){?>
	<script>
		alert("<? echo _CONST_FUNCTION_PERMISSION_ERROR; ?>");
		if (_MODAL_DIALOG_MODE==1){
			window.location = "<? echo $v_url; ?>";
		}else{
			window.history.back();
		}	
	</script><?
	exit;
}
if(isset($_REQUEST['hdn_back_cate_id']))
{
	$v_cate_id = $_REQUEST['hdn_back_cate_id'];
}
if(isset($_REQUEST['hdn_back_agency_id']))
{
	$v_agency_id = $_REQUEST['hdn_back_agency_id'];
}
if (isset($_REQUEST['hdn_method'])){
	$v_method = $_REQUEST['hdn_method'];
}
if (isset($_REQUEST['hdn_status']))
{
	$v_status = $_REQUEST['hdn_status'];
}
$v_filter = $_REQUEST['hdn_filter'];
$v_list_af_id = $_REQUEST['hdn_list_af_id']; 
if(_is_sqlserver()){
	$cmd = mssql_init("Onegate_AFDelete",$conn); 
	mssql_bind($cmd, "@p_af_id_list", $v_list_af_id, SQLVARCHAR);    
	$result = mssql_execute($cmd); 
	$rs = @mssql_fetch_array($result);
	$v_error = _replace_bad_char(trim($rs['RET_ERROR']));
}

if (!is_null($v_error) and $v_error<>""){?>
	<script>
		alert("<? echo $v_error; ?>");
		window.history.back();
	</script><?php
	exit;
}?>
<form action="index.php"  Name="f_back" method="post">
	<input type="hidden" name="fuseaction" value="DISPLAY_ALL_AF">	
	<input name="hdn_filter" type="hidden" value="<?php echo $v_filter; ?>">
	<input name="hdn_back_cate_id" type="hidden" value="<?php echo $v_cate_id; ?>">
	<input name="hdn_back_agency_id" type="hidden" value="<?php echo $v_agency_id; ?>">
	<input name="hdn_status" type="hidden" value="<?php echo $v_status; ?>">
	<input name="hdn_method" type="hidden" value="<?php echo $v_method; ?>">
</form>		
<Script language="javascript">	
	document.forms(0).submit();
</Script> 


